package com.xbongbong.parent.interfaces;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.pojo.HandelDetailPojo;
import com.xbongbong.paas.pojo.SummaryDataPoJo;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.wrap.UserVO;
import com.xbongbong.pro.appdetail.pojo.MobileDetailMoneyItemPojo;
import com.xbongbong.pro.appdetail.pojo.MobileDetailScriptPojo;
import com.xbongbong.pro.appdetail.pojo.MobileDetailSpecialInfoPojo;
import com.xbongbong.pro.appdetail.pojo.MobileDetailStatusPojo;
import com.xbongbong.pro.form.pojo.TopPermissionsPoJo;
import com.xbongbong.pro.formdata.pojo.dto.FormDataDetailDTO;
import com.xbongbong.pro.formdata.pojo.vo.MobileFormCommonDetailVO;
import com.xbongbong.pro.formexplain.pojo.dto.HandlerExplainDTO;

import java.util.List;
import java.util.Map;

/**
 * @author 吴峰
 * @date 2022/02/16 14:18
 */
public interface BusinessMobileDetailTopInfoService<T, D> {

    /**
     * 获取移动端详情金额区块信息
     * 重构于com.xbongbong.saas.service.MobileDetailService#getMobileDetailMoneyInfo(java.lang.Integer, java.lang.String, java.lang.String, java.lang.Integer, java.lang.Integer, java.lang.Long, com.alibaba.fastjson.JSONObject, java.util.Map, com.xbongbong.paas.toolbox.wrap.UserVO) 2022/2/16 16:31
     * @param distributorMark 经销商标识
     * @param corpid          公司id
     * @param userId          用户id
     * @param businessType    业务类型
     * @param subBusinessType 具体业务类型 比如：工作报告的日报/周报/月报
     * @param dataId          数据id
     * @param data            表单数据
     * @param explainMap      表单解释
     * @param loginUser
     * @param paasFormDataEntityExt 源数据
     * @return List
     * @throws XbbException XbbException
     * @author GuoJun.HU
     * @date 2019/3/13 18:50

     * @since V1.0
     */
    List<MobileDetailMoneyItemPojo> getMobileDetailMoneyInfo(Integer distributorMark, String corpid, String userId, Integer businessType,
                                                             Integer subBusinessType, Long dataId, JSONObject data,
                                                             Map<String, FieldAttrEntity> explainMap, UserVO loginUser, D paasFormDataEntityExt) throws XbbException;

    /**
     * 获取移动端详情基本信息中的中部信息
     * 重构于  com.xbongbong.saas.service.MobileDetailService#getBottomBlockInfo(java.lang.String, java.lang.String, java.lang.Integer, java.lang.Long, com.alibaba.fastjson.JSONObject, java.util.Map, com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt, com.xbongbong.paas.pojo.dto.FormDataGetDTO)
     * @param corpid       公司id
     * @param userId       用户id
     * @param businessType 业务类型
     * @param formEntity 表单实体
     * @param dataId       数据id
     * @param data         表单数据，经过解析后的数据，返回给前端的
     * @param explainMap
     * @param entityExt 数据库原数据
     * @param handlerExplainDTO
     * @return JSONArray
     * @throws XbbException XbbException
     * @author GuoJun.HU
     * @date 2019/3/13 18:50
     * @since V1.0
     *
     */
    JSONArray getBottomBlockInfo(String corpid, String userId, Integer businessType, T formEntity, Long dataId, JSONObject data, Map<String, FieldAttrEntity> explainMap, D entityExt, HandlerExplainDTO handlerExplainDTO) throws XbbException;

    /**
     * 移动端详情基础信息右侧显示的特殊信息
     * 重构于 com.xbongbong.saas.service.MobileDetailService#getMobileDetailSpecialInfo(com.xbongbong.paas.enums.SheetTypeEnum, java.lang.String, com.xbongbong.paas.toolbox.wrap.UserVO, java.lang.Integer, com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt, java.util.Map)
     * @param formDataDetailDTO
     * @param paasFormDataEntityExt 数据实体
     * @param explainMap   解释
     * @return MobileDetailSpecialInfoPojo
     * @throws XbbException XbbException
     * @author GuoJun.HU
     * @date 2019/3/13 13:47
     * @update 2019/11/29 by zcp 增加回款单情况处理（回款单有7种类型，其中预收款核销的金额在核销金额字段内）
     * @since V1.0
     */
    MobileDetailSpecialInfoPojo getMobileDetailSpecialInfo(FormDataDetailDTO formDataDetailDTO,  D paasFormDataEntityExt, Map<String, FieldAttrEntity> explainMap) throws XbbException;

    /**
     * 获取移动端详情基础信息右上角显示的内容
     * 重构于 com.xbongbong.saas.service.impl.MobileDetailServiceImpl#getDetailShowScript
     * @param businessType 业务类型
     * @param loginUser
     * @param paasFormDataEntityExt
     * @param explainMap   解释
     * @return List
     * @author GuoJun.HU
     * @date 2019/3/13 11:10
     * @since V1.0
     * @update 2019/11/29 by zcp 增加回款单情况处理（回款单有7种类型，其中预收款核销的金额在核销金额字段内）
     * @throws XbbException
     */
    List<MobileDetailScriptPojo> getDetailShowScript(Integer businessType, UserVO loginUser, D paasFormDataEntityExt, Map<String, FieldAttrEntity> explainMap) throws XbbException;
    /**
     * 获取移动端详情基础信息右侧显示的状态
     * 重构于 com.xbongbong.saas.service.impl.MobileDetailServiceImpl#getDetailShowStatus
     *
     * @param businessType 业务类型
     * @param data         表单数据
     * @return MobileDetailStatusPojo
     * @author GuoJun.HU
     * @date 2019/3/13 11:10
     * @since V1.0
     * @update 2019/11/29 by zcp 增加回款单情况处理
     * @throws XbbException
     */
    MobileDetailStatusPojo getDetailShowStatus(Integer businessType, JSONObject data) throws XbbException;

    /**
     * 获取移动端详情基础信息右上角的操作
     * 重构于 com.xbongbong.saas.service.impl.MobileDetailServiceImpl#getDetailShowOperation(java.lang.String, java.lang.String, java.lang.Integer, java.lang.Long, com.alibaba.fastjson.JSONObject)
     *
     * @param corpid       公司id
     * @param userId       用户id
     * @param businessType 业务类型
     * @param dataId       数据id
     * @param data         表单数据
     * @return List
     * @author GuoJun.HU
     * @date 2019/3/13 11:10
     * @since V1.0
     * @throws XbbException
     */
    Map<String, Object> getDetailShowOperation(String corpid, String userId, Integer businessType, Long dataId, JSONObject data) throws XbbException;

    /**
     * 返回
     * ->com.xbongbong.saas.help.SaasGetHelp#formatSaasAttrToReturn(com.xbongbong.paas.pojo.vo.FormDataGetVO, com.xbongbong.paas.pojo.dto.FormDataGetDTO, com.alibaba.fastjson.JSONObject)
     * @param corpid
     * @param businessType
     * @param userVO
     * @param paasFormDataEntityExt
     * @throws XbbException
     * @return
     */
    JSONObject returnSaasObject(String corpid, Integer businessType, UserVO userVO, D paasFormDataEntityExt) throws XbbException ;

    /**
     * com.xbongbong.saas.service.impl.MobileDetailServiceImpl#handelMobileWorkFlow(com.xbongbong.paas.toolbox.wrap.UserVO, java.lang.Integer, com.xbongbong.paas.pojo.vo.FormDataGetVO, com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt)
     * 手机端，返回关联新建
     * @param handelDetailPojo
     * @param formEntity
     * @param formData
     * @param explainMap
     * @return
     * @throws XbbException
     */
    List<TopPermissionsPoJo> dingtalkHandleDetailWorkFlow(HandelDetailPojo handelDetailPojo, T formEntity, D formData, Map<String, FieldAttrEntity> explainMap) throws XbbException;


    /**
     * 获取移动端详情页底部操作按钮
     * 重构于com.xbongbong.saas.service.MobileDetailService#getMobileDetailBottomOperation(com.xbongbong.paas.pojo.HandelDetailPojo)
     * @param handelDetailPojo
     * @param formData
     * @param formEntity
     * @param handlerExplainDTO
     * @param explainMap
     * @return
     * @throws XbbException
     */
    List<TopPermissionsPoJo> getMobileDetailBottomOperation(HandelDetailPojo handelDetailPojo, T formEntity, D formData, HandlerExplainDTO handlerExplainDTO, Map<String, FieldAttrEntity> explainMap) throws XbbException;

    /**
     * 处理标签
     * @param formDataDetailDTO
     * @param formEntity
     * @param labelList
     * @param paasFormDataEntityExt
     * @param explainMap
     * @return java.lang.String
     * @author 吴峰
     * @date 2022/2/11 19:11
     * @throws XbbException
     */
    String dealAppDetailLabelListLocation(FormDataDetailDTO formDataDetailDTO, T formEntity, List<SummaryDataPoJo> labelList, D paasFormDataEntityExt, Map<String, FieldAttrEntity> explainMap) throws XbbException;


    /**
     * 手机端返回vo
     * @param formEntity
     * @param formData
     * @param mobileFormCommonDetailVO
     * @throws XbbException
     */
    void returnVO(T formEntity, D formData, MobileFormCommonDetailVO mobileFormCommonDetailVO, String userId) throws XbbException;


}
